In [1]:
from IPython.html.widgets import interactive, DropdownWidget
from nanopb_helpers import dump_message
from serial import Serial
from serial_device import get_serial_ports
import signal_generator as device
def dump_status():
print dump_message(proxy.config)
print ''
print dump_message(proxy.state)
In [2]:
serial_port = DropdownWidget(values=list(get_serial_ports()),
description='Device serial port:')
serial_port
In [3]:
serial_device = Serial(serial_port.value, baudrate=115200)
proxy = device.Proxy(serial_device)
In [5]:
dump_status()
In [6]:
proxy.reset_config()
proxy.reset_pots()
proxy.reset_state()
dump_status()
In [7]:
def adjust_gain_potentiometer(value=128):
proxy.set_pot(3, value)
proxy.update_state(voltage=1., frequency=1e3)
interactive(adjust_gain_potentiometer, value=(1, 255))
In [8]:
def adjust_hf_amplitude_correction(value=1.19):
proxy.update_config(hf_amplitude_correction=value)
proxy.update_state(voltage=1., frequency=10e3)
interactive(adjust_hf_amplitude_correction, value=(1.1, 1.3, 0.001))
In [11]:
def test_device(voltage=1, frequency=1e3):
proxy.update_state(voltage=voltage, frequency=frequency)
interactive(test_device,
voltage=(0, proxy.config.max_waveform_voltage, 0.05),
frequency=(proxy.config.min_waveform_frequency,
proxy.config.max_waveform_frequency, 1))
In [10]:
proxy.save_config()